﻿#include "widget.h"
#include "ui_widget.h"
#include <QString>
#include <QDebug>
#include "DatabaseManage.h"

Widget::Widget(QWidget *parent)
    : QWidget(parent)
    , ui(new Ui::Widget)
{
    // 设置控制台编码为UTF-8
    system("chcp 65001");

    ui->setupUi(this);
}

Widget::~Widget()
{
    delete ui;
}

void Widget::on_pushButton_clicked()
{
    QString username = this->ui->le_username->text();
    QString password = this->ui->le_password->text();
    QString port = this->ui->le_port->text();
    QString dbName = this->ui->le_db_name->text();
    QString ip = this->ui->le_ip->text();

    QSqlDatabase db = DatabaseManage::getInstance()->initDatabase(username, password, dbName, ip, port.toInt());
    db.close();
}

